The TextField Component > FTextField.setEnabled()

 

FTextField.setEnabled()

Availability

Flash Player 6.

Usage

myTextField_txf.setEnabled (enabled)

Parameters

enabled A Boolean value specifying whether the component is enabled (true) or disabled (false).

Returns

Nothing.

Description

Specifies whether the component is enabled (true) or disabled (false). If the component is disabled, it will not accept mouse or keyboard interaction from the user. The component will also be grayed-out to visually indicate its state to the user.

Notes

When the component is not enabled, the background and text will be grayed-out. If the text field contains no text, and the background is not displayed, then the change in visible state will not be noticeable. Thus, you must enabled the background while the component is not enabled, and then disable the background when the component is enabled. This only applies if there is no text within the text field.

function enabled()
{
	myTextField_txf.background = false;
	myTextField_txf.setEnabled(true);
}


function disable()
{
	myTextField_txf.background = true;
	myTextField_txf.setEnabled(false);
}

Example

The text_validation.fla example file contains an example of using this method.

The following code disables the textfield.

myTextField_txf.setEnabled(false);

See also

FTextField.getEnabled()